package com.andy.entity;
// default package
// Generated 2016-10-6 2:36:27 by Hibernate Tools 4.0.0.Final

import java.math.BigDecimal;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * ExamSubject generated by hbm2java
 */
@Entity
@Table(name = "exam_subject")
public class ExamSubject implements java.io.Serializable {

	private static final long serialVersionUID = -7030466840712461289L;
	private Integer subId;
	private String name;
	private String description;
	private int testCount;
	private int totalTime;
	private BigDecimal totalScore;
	private int status;
	private Set<ExamUser> examUsers;

	public ExamSubject() {
	}

	public ExamSubject(String name, String description, int testCount, int totalTime, BigDecimal totalScore) {
		this.name = name;
		this.description = description;
		this.testCount = testCount;
		this.totalTime = totalTime;
		this.totalScore = totalScore;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "sub_id", unique = true, nullable = false)
	public Integer getSubId() {
		return this.subId;
	}

	public void setSubId(Integer subId) {
		this.subId = subId;
	}

	@Column(name = "name", nullable = false, length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description", nullable = false)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "test_count", nullable = false)
	public int getTestCount() {
		return this.testCount;
	}

	public void setTestCount(int testCount) {
		this.testCount = testCount;
	}

	@Column(name = "total_time", nullable = false)
	public int getTotalTime() {
		return this.totalTime;
	}

	public void setTotalTime(int totalTime) {
		this.totalTime = totalTime;
	}

	@Column(name = "total_score", nullable = false, precision = 5)
	public BigDecimal getTotalScore() {
		return this.totalScore;
	}

	public void setTotalScore(BigDecimal totalScore) {
		this.totalScore = totalScore;
	}
	
	@Column(name = "status", nullable = false)
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@ManyToMany(mappedBy = "examSubjects", cascade = {CascadeType.DETACH, CascadeType.PERSIST, CascadeType.MERGE})
	public Set<ExamUser> getExamUsers() {
		return examUsers;
	}

	public void setExamUsers(Set<ExamUser> examUsers) {
		this.examUsers = examUsers;
	}
}
